<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('四向车监控')"/>
    <th:block th:include="include :: layout-latest-css"/>
    <th:block th:include="include :: bootstrap-editable-css"/>
    <th:block th:include="include :: ztree-css"/>
</head>
<body class="gray-bg">
<div class="ui-layout-center">
    <div class="container-div">
        <div class="row col-sm-12">
            <div id="div2" style="height: 40%;width: 100%" class="col-sm-5 select-table">
                <h3>四向车</h3>
                <table id="bootstrap-table2"></table>
            </div>
            <div id="div1" class="col-sm-5 select-table" style="height: 100%;width: 49%;top :1%">
                <h3>入库巷道口</h3>
                <table id="bootstrap-table1"></table>

            </div>
            <div id="div4" style="height: 100%;width: 50%; left:1%; top: 1%" class="col-sm-5 select-table">
                <h3>出库巷道口</h3>
                <table id="bootstrap-table4"></table>
            </div>
        </div>

    </div>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: layout-latest-js"/>
<th:block th:include="include :: bootstrap-table-editable-js"/>
<th:block th:include="include :: ztree-js"/>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('system:manage:edit')}]];
    var removeFlag = [[${@permission.hasPermi('system:manage:remove')}]];
    var prefix = ctx + "system/manage";
    $(function () {
        var panehHidden = false;
        if ($(this).width() < 769) {
            panehHidden = true;
        }
        $('body').layout({initClosed: panehHidden, west__size: 85});
        // 回到顶部绑定
        if ($.fn.toTop !== undefined) {
            var opt = {
                win: $('.ui-layout-center'),
                doc: $('.ui-layout-center')
            };
            $('#scroll-up').toTop(opt);
        }

        queryUserList1();
        queryUserList2();
        // queryUserList3();
        queryUserList4();
        // queryUserList5();
        // queryUserList6();

        reloadTable();


    });

    function reloadTable() {

        $('#bootstrap-table1').bootstrapTable('refresh');
        $('#bootstrap-table2').bootstrapTable('refresh');
        // $('#bootstrap-table3').bootstrapTable('refresh');
        $('#bootstrap-table4').bootstrapTable('refresh');
        // $('#bootstrap-table5').bootstrapTable('refresh');
        // $('#bootstrap-table6').bootstrapTable('refresh');

        setTimeout(reloadTable, 3 * 1000);
    }


    function queryUserList1() {

        var options1 = {
            url: "/msgLxkSsj/lxk/list?location=3",
            height: $("#div1").height() * 0.95,
            modalName: "id",
            columns: [

                {
                    field: 'id',
                    title: '设备编号 ',
                    align: 'center',
                },
                // {
                //     field: 'location',
                //     title: '',
                //     sortable: true
                // },
                {
                    field: 'name',
                    title: '设备名称 ',
                    align: 'center',
                },
                {
                    field: 'rwh',
                    title: '任务号 ',
                    align: 'center',
                },
                {
                    field: 'dw',
                    title: '到位信号',
                    align: 'center',
                    formatter: function (value, row, index) {
                        if (value == 1) {
                            return "入库到位";
                        } else if (value == 2) {
                            return "出库到位";
                        } else {
                            return "未到位";
                        }
                    }
                },
                {
                    field: 'kx',
                    title: '空闲信号 ',
                    align: 'center',
                    formatter: function (value, row, index) {
                        if (value == 1) {
                            return "空闲";
                        } else {
                            return "未空闲";
                        }
                    }
                },

                {
                    field: 'floor',
                    title: '对应层',
                    sortable: true,
                    align: 'center',

                }
            ]
        };
        $('#bootstrap-table1').bootstrapTable(options1)
    }

    function queryUserList2() {

        var options1 = {
            url: prefix + "/list",
            editUrl: prefix + "/edit",
            height: $("#div2").height() / 1.3,
            modalName: "sxc",
            columns: [

                {
                    field: 'name',
                    title: '设备名称',
                    halign: 'center',
                    align: 'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'floor',
                    title: '小车当前层',
                    halign: 'center',
                    align: 'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'area',
                    title: '对应货区',
                    halign: 'center',
                    align: 'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'distance',
                    title: 'Y轴距离',
                    halign: 'center',
                    align: 'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'mbFloor',
                    title: '目标层',
                    halign: 'center',
                    align: 'center',
                    sortable: true,
                    visible: true
                },

                {
                    field: 'yxxf',
                    title: '小车状态',
                    halign: 'center',
                    align: 'center',
                    sortable: true,
                    visible: true,
                    formatter: function (value, row, index) {
                        if (value == 1) {
                            return "正常"
                        } else {
                            return "报警"
                        }

                    }
                },

                {
                    field: 'distanceX',
                    title: 'X轴距离',
                    halign: 'center',
                    align: 'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'zhzt',
                    title: '载货状态',
                    halign: 'center',
                    align: 'center',
                    sortable: true,
                    visible: false,
                    formatter: function (value, row, index) {
                        if (value == 1) {
                            return "空车"
                        } else {
                            return "载货"
                        }

                    }
                },
                {
                    field: 'ip',
                    title: '小车IP',
                    halign: 'center',
                    align: 'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'port',
                    title: '小车端口',
                    halign: 'center',
                    align: 'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'sendTime',
                    title: '下发时间',
                    halign: 'center',
                    align: 'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'easyTime',
                    title: '空闲时间',
                    halign: 'center',
                    align: 'center',
                    sortable: true,
                    visible: true,
                    // editable: {
                    //     type: 'text',
                    //     title: '空闲时间（分钟）',
                    //     disabled: false,
                    //     validate: function (value) {
                    //         if (value.length == 0) {
                    //             return '批号不能为空';
                    //         }
                    //     }
                    // },

                }
                // ,
                // {
                //     title: '操作',
                //     halign: 'center',
                //     align: 'center',
                //     formatter: function (value, row, index) {
                //         var actions = [];
                //         actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                //         // actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                //         return actions.join('');
                //     }
                // }
            ]
        };
        $('#bootstrap-table2').bootstrapTable(options1)
    }

    function queryUserList4() {

        var options4 = {
            url: "/msgLxkSsj/lxk/list?location=4",
            height: $("#div4").height() * 0.95,
            modalName: "id",
            columns: [

                {
                    field: 'id',
                    title: '设备编号 ',
                    align: 'center',
                },
                // {
                //     field: 'location',
                //     title: '',
                //     sortable: true
                // },
                {
                    field: 'name',
                    title: '设备名称 ',
                    align: 'center',
                },
                {
                    field: 'rwh',
                    title: '任务号 ',
                    align: 'center',
                },
                {
                    field: 'dw',
                    title: '到位信号',
                    align: 'center',
                    formatter: function (value, row, index) {
                        if (value == 1) {
                            return "入库到位";
                        } else if (value == 2) {
                            return "出库到位";
                        } else {
                            return "未到位";
                        }
                    }
                },
                {
                    field: 'kx',
                    title: '空闲信号 ',
                    align: 'center',
                    formatter: function (value, row, index) {
                        if (value == 1) {
                            return "空闲";
                        } else {
                            return "未空闲";
                        }
                    }
                },

                {
                    field: 'floor',
                    title: '对应层',
                    sortable: true,
                    align: 'center',

                }
            ]
        };
        $('#bootstrap-table4').bootstrapTable(options4)
    }
</script>
</body>
</html>